1. Field of Invention
The disclosed invention relates to image processing technology in video and image-related equipment. In particular, the invention relates to an image processing method and image processing apparatus suitable for correcting the shading of an image photographed by a sensor such as a CCD camera or the like in which shading (a difference in brightness caused by illumination unevenness) is created.
2. Description of Related Art
In images photographed by an area sensor, such as a CCD camera or the like, a dark shadow may appear in the image after digital processing because of the effects of shading. In particular, the effects of shading often appear in the areas near the edge of the image (the periphery of the image). Furthermore, in contrast to taking natural images such as scenery, when an image is taken of line drawings, such as diagrams or characters in a uniform background color, the effects of shading are striking in the image and do not look good.
Compact portable information processing equipment has recently been commercialized which allows not only hand-written input information, but also images to be uptaken by using a CCD camera or the like. This compact portable information processing equipment is provided with a display unit for simultaneously uptaking and displaying the uptaken information, and for reading and displaying information already uptaken. Out of consideration for battery life, a reflective liquid crystal display device (LCD) is commonly used as the display unit for this type of compact portable equipment.
The LCD generally has a small number of display gradations (color shades or gray scale) and, for example, four gradations are frequently used. In contrast to this, a CCD camera using a CCD photography device has 256 gradations (color shades or gray scale), which is a large number of gradations. Accordingly, when the image uptaken by the CCD camera is displayed on the LCD, it is necessary to reduce the number of gradations.
When the process for reducing the number of gradations is performed, in converting, for example, an image in which the periphery is dark because of the effects of the kind of shading discussed above to four gradations, there are cases where the post-processing image has dark areas on the periphery that appear to be smeared black.
Hence, for images that have received the effects of shading, it is necessary to revise the effects of this shading.
In accordance with a conventional method of shading correction, the image data of one screen that has the effects of shading is uptaken, following which the screen is partitioned into several regions so as to have similar brightness, and a process is performed so that the whole screen has a smooth change in brightness (see Shingaku Giho, IE 96-21, 1996-09, "Research on Binarization of Images Uptaken by CCD Cameras").
Conventionally, shading correction involves a process that uptakes one screen of image data and partitions it into several regions. Consequently, a memory having a large enough capacity to store at least one screen of image data is necessary for working memory.
However, CCD cameras are often used in compact equipment. In particular, it is expected that use in portable information processing equipment, such as electronic notebooks, will further increase in the future. In this kind of equipment, compactness, light weight, and low cost are desired. Hence, there are great restrictions on the components used. Accordingly, it is desirable to use as small a working memory as possible.
In addition, objects photographed by the CCD camera may not only be line drawings, but also may be natural images such as scenery. When these kinds of images are displayed on a display unit with a small number of gradations, as described above, it is necessary to conduct a process for reducing the number of gradations (e.g., a process to go from 256 gradations to 4 gradations).
Processes for reducing the number of gradations include the "Ohtsu method" (see the Denki Tsushin Gakkai Ronbun Magazine, '84/4, vol, J63-D, No. 4, pg. 349), the error diffusion method and the dither method.
The aforementioned "Ohtsu method" is a technology suited for setting the threshold values used in binarization. By using this in the case of conversion to four gradations, a process is first conducted for setting the threshold value used in binarization, and then a process is conducted which finds the respective threshold values for the respective regions partitioned using this first threshold value. This method requires a large volume of computations, but is an effective method for images such as line drawings in which preserving the clarity of the edge is necessary.
On the other hand, the error diffusion method and the dither method are methods that output gradations two dimensionally, and consequently have the defect that it is difficult to preserve the edge. Hence, when an image such as a line drawing with characters or diagrams in the midst of a bright background is uptaken and the gradation conversion process is performed, the edge portions of the line drawing containing the most meaningful information become unclear, and a quality image cannot be obtained.
Thus, for line drawings, such as characters or diagrams, a binarization process using a specific threshold value in accordance with the Ohtsu method or the like is appropriate. For natural images, the error diffusion method and the dither method which output gradations two-dimensionally are appropriate. Accordingly, in order to reduce the number of gradations, it is desirable to execute a gradation process, i.e., a halftoning process or an indexing process, for example. In particular, the dither method or an error diffusion process may be used. The type of gradation process is selected in accordance with whether the object is a line drawing or a natural image.